<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <link rel="stylesheet" href="../../css/geological/reset.css"/>
    <link rel="stylesheet" href="../../css/geological/css.css"/>
    <link rel="stylesheet" href="../../css/geological/animate.css"/>
    <link rel="stylesheet" href="../../css/geological/public.css"/>
    <script type="text/javascript" src="../../js/geological/jquery.min.js"></script>
    <script type="text/javascript" src="../../js/geological/jquery.validate.min.js"></script>
    <script type="text/javascript" src="../../js/geological/messages_zh.min.js"></script>
    <script type="text/javascript" src="../../js/geological/jquery.niceScroll.min.js"></script>
    <link rel="stylesheet" type="text/css" href="../../js/geological/jquery.confirm/jquery.confirm.css"/>
 	<script type="text/javascript" src="../../js/geological/jquery.confirm/jquery.confirm.js"></script>
    
    <link rel="stylesheet" type="text/css" href="../../js/geological/zTree/zTreeStyle/zTreeStyle.css"/>
    <script type="text/javascript" src="../../js/geological/zTree/jquery.ztree.all.min.js"></script>
    
    <link rel="stylesheet" type="text/css" href="../../css/geological/jquery.dataTables.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/geological/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="../../css/geological/daterangepicker.css" />
    <link rel="stylesheet" href="../../plugins/uploadify/uploadify.css" />
    
    <script type="text/javascript" src="../../js/geological/jquery.dataTables.js"></script>
    <script type="text/javascript" src="../../js/geological/moment.min.js"></script>
    <script type="text/javascript" src="../../js/geological/daterangepicker.js"></script>
 	<script type="text/javascript" src="../../js/geological/public.js"></script>
 	<script type="text/javascript" src="../../plugins/uploadify/jquery.uploadify.min.js"></script>
    <!--[if lt IE 9]>
    <script src="../../js/geological/html5shiv.min.js"></script>
    <script src="../../js/geological/respond.min.js"></script>
    <![endif]-->
    <title>首页</title>
    
    <script type="text/javascript">
    var global = {};
    global.search_station_type = null;
    global.search_station_id = null;
    global.search_station_ids = null;
    
    $(document).ready(function(){
    	var url = "../../tbl_area/system_area";
		$.ajax({
			  url: url,
			  type : 'get',
			  async : false,
			  contentType: "application/json; charset=utf-8",
			  success: function(json) {
				  if( json.data != null ){
					  global.system_provinde_code = json.data.system_province_code;
					  global.system_provinde_name = json.data.system_province_name;
					  global.system_city_code = json.data.system_city_code;
					  global.system_city_name = json.data.system_city_name;
					  
					  $("#top_frame").load("top.html");
				      $("#middle_frame").load("main.html");
				  }else{
					  global.alert( "系统未获取到支持的省份，请联系管理员！" );
				  }
			  }
		});
    	
    	global.catchLoginUser();
    });
    global.catchLoginUser = function(){
		var url = "../../currentPerson";
		$.ajax({
			  url: url,
			  type : 'get',
			  async : false,
			  contentType: "application/json; charset=utf-8",
			  success: function(json) {
				  if( json.result == "success" ){
					  if( json.currentPerson == null ){
						  global.alert(json.message);
						  window.location.href="login.html";
					  }else{
						  global.currentPerson = json.currentPerson;
						  global.currentRole = json.currentRole;
					  }
				  }else{
					  global.alert( json.message );
				  }
			  }
		});
    }
    global.showModal = function( title, url ){
    	global.dialog = $.dialog({
    	    boxWidth: '800px',
    	    boxHeight: 'auto',
    	    useBootstrap: false,
    	    title: title,
    	    content: 'url:' + url,
    	    contentLoaded: function( data, status, xhr ){
    	        // data is already set in content
    	        // this.setContentAppend('<br>Status: ' + status);
    	    }
    	});
    }
    
    global.showIndexModal = function( title, url, width, height ){
    	global.dialog = $.dialog({
    	    boxWidth: width,
    	    boxHeight: height,
    	    useBootstrap: false,
    	    title: title,
    	    content: 'url:' + url,
    	    contentLoaded: function( data, status, xhr ){
    	        // data is already set in content
    	        // this.setContentAppend('<br>Status: ' + status);
    	    }
    	});
    }

    global.alert = function( message, title ){
    	if( title == null ){
    		title = "操作提示！"
    	}
    	$.alert({
		    title: title,
		    content: message,
		    confirm: function(){
		    }
		});
    }
   
    /** 
     * 时间对象的格式化; 
     */  
    Date.prototype.format = function(format) {  
        /* 
         * eg:format="yyyy-MM-dd hh:mm:ss"; 
         */  
        var o = {  
            "M+" : this.getMonth() + 1, // month  
            "d+" : this.getDate(), // day  
            "h+" : this.getHours(), // hour  
            "m+" : this.getMinutes(), // minute  
            "s+" : this.getSeconds(), // second  
            "q+" : Math.floor((this.getMonth() + 3) / 3), // quarter  
            "S" : this.getMilliseconds()  
            // millisecond  
        }  
      
        if (/(y+)/.test(format)) {  
            format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4  
                            - RegExp.$1.length));  
        }  
      
        for (var k in o) {  
            if (new RegExp("(" + k + ")").test(format)) {  
                format = format.replace(RegExp.$1, RegExp.$1.length == 1  
                                ? o[k]  
                                : ("00" + o[k]).substr(("" + o[k]).length));  
            }  
        }  
        return format;  
    }
    </script>
</head>
<body id="index">
<div id="top_frame" class="header clearfix"></div>
<div id="middle_frame" class="index-main clearfix"></div>
</body>
<script type="text/javascript" src="http://cdn.bootcss.com/echarts/3.6.1/echarts.min.js"></script>
</html>